# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=nsss
pkgver=0.2.0.4
pkgrel=0
pkgdesc="A small and statically linkable alternative to Name Service Switch"
url="https://skarnet.org/software/nsss"
arch="all"
license="ISC"
options="!check"
makedepends="skalibs-dev>=2.13"
subpackages="$pkgname-dev $pkgname-doc"
source="https://skarnet.org/software/nsss/nsss-$pkgver.tar.gz"

build() {
	./configure \
		--enable-shared \
		--enable-static \
		--disable-allstatic \
		--prefix=/usr \
		--libdir=/usr/lib \
		--libexecdir="/usr/lib/$pkgname" \
		--with-dynlib=/lib
	make
}

check() {
	# To run this, you need the s6-ipcserver package installed.
	# Checks are disabled because s6-ipcserver may be built with nsss,
	# and we want to avoid cycles.
	mkdir -p ROOT
	make DESTDIR="$builddir/ROOT" install
	env LD_LIBRARY_PATH="$builddir/ROOT/usr/lib" make check
}

package() {
	make DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir/usr/share/doc"
	cp -a doc "$pkgdir/usr/share/doc/$pkgname"
}

sha512sums="
e658724d1ae549d856026504c0eb7517f9e28a9fbd4ad5f120410929e23cf9ea182584b34929414b154640aaa50dfb06dc6f56738a3443fc86d1e7d9a5b29f84  nsss-0.2.0.4.tar.gz
"
